import request from '@/utils/request'
import { isNotEmpty } from '@/utils'
import { getItem } from '@/utils/auth'

export function fetchSequenceDefineList(data) {
  return request({
    url: '/cloud-system/getSequenceDefineList',
    method: 'post',
    data
  })
}

export function fetchSequenceDefineOne(data) {
  return request({
    url: '/cloud-system/getOneSequenceDefineDetail',
    method: 'post',
    data
  })
}

export function createSequenceDefine(data) {
  return request({
    url: '/cloud-system/createOneSequenceDefine',
    method: 'post',
    data
  })
}
export function updateSequenceDefine(data) {
  return request({
    url: '/cloud-system/updateOneSequenceDefine',
    method: 'post',
    data
  })
}

export function deleteSequenceDefine(data) {
  return request({
    url: '/cloud-system/deleteOneSequenceDefine',
    method: 'post',
    data
  })
}
export function batchDeleteSequenceDefine(data) {
  return request({
    url: '/cloud-system/batchDeleteSequenceDefine',
    method: 'post',
    data
  })
}

export function lockSequenceDefine(data) {
  return request({
    url: '/cloud-system/lockOneSequenceDefine',
    method: 'post',
    data
  })
}

export function unlockSequenceDefine(data) {
  return request({
    url: '/cloud-system/unlockOneSequenceDefine',
    method: 'post',
    data
  })
}

export function batchLockSequenceDefine(data) {
  return request({
    url: '/cloud-system/batchLockSequenceDefine',
    method: 'post',
    data
  })
}

export function batchUnLockSequenceDefine(data) {
  return request({
    url: '/cloud-system/batchUnLockSequenceDefine',
    method: 'post',
    data
  })
}

export function login(data) {
  return request({
    url: '/cloud-system/userLogin',
    method: 'post',
    data
  })
}

export function logout(data) {
  return request({
    url: '/cloud-system/userLogout',
    method: 'post',
    data
  })
}

export function createUser(data) {
  return request({
    url: '/cloud-system/createOneUser',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/cloud-system/updateOneUser',
    method: 'post',
    data
  })
}

export function deleteUser(data) {
  return request({
    url: '/cloud-system/deleteOneUser',
    method: 'post',
    data
  })
}

export function getUserList(parameter) {
  const data = JSON.parse(getItem('baseParam'))
  if (isNotEmpty(parameter)) {
    data.parameterArray += (',' + parameter)
  }
  return request({
    url: '/cloud-system/getUserList',
    method: 'post',
    data: data
  })
}


